Several conventional approaches exist for collecting context for context adaptive binary arithmetic coding (CABAC) for use in digital video encoding and decoding. A first conventional approach is a public software implementation, referred to as the “JM software version 6.2”, available from a Joint Video Team (JVT) of the International Organization for Standardization/International Electrotechnical Commission (ISO/IEC) MPEG and the Video Coding Expert Group (VCEG) of the International Telecommunications Union-Telecommunications Standardization Sector (ITU-T). A second conventional approach is a document “Draft ITU-T Recommendation and Final Draft International Standard of Joint Video Specification (ITU-T Rec. H.264 | ISO/IEC 14496-10 AVC)”, document number JVT-G050r1, also available from the JVT, referred to as the “JVT-G050r1 document”. Both approaches could be more efficient when dealing with subpartitioned macroblocks neighboring a current macroblock being considered.
The following code indicates a relevant portion of a method implemented by the JM software version 6.2:
if((img -> subblock_y ==0) && ((currMB -> mb_available[0] [1] ==NULL) ∥ (IS_DIRECT(currMB -> mb_available[0] [1]))))b = 0;elseb = (refframe_array[block_y+img -> subblock_y-1] [img ->block_x+img -> subblock_x] > 0? 1 : 0);if ((img -> subblock_x ==0) && ((currMB -> mb_available[1] [0] ==NULL) ∥ (IS_DIRECT(currMB -> mb_available[1] [0]))))a = 0;elsea = (refframe_array[block_y+img -> subblock_y] [img ->block_x+img -> subblock_x−1] > 0? 1 : 0);act_ctx = a + 2*b;
The JM software version 6.2 is problematic because the JM software does not check if a neighboring 8×8 sub-macroblock of a subpartitioned macroblock is skipped or direct before calculating the context for the current macroblock/sub-macroblock. Not checking the mode of the neighboring 8×8 sub-macroblock undesirably leads to having a compliant decoder derive reference indices and/or motion vectors for direct-mode or skipped neighbors in order to CABAC parse the syntax elements for the current macroblock/sub-macroblock. In most pipelined designs, the derived results would not be available at the time of the current parsing, causing a pipeline stall. For some specialized architectures that attempt to do CABAC parsing completely separately from the rest of the decoding process, the JM software version 6.2 approach would mean having to replicate a complex decoding process for direct-mode prediction of reference indices and motion vectors in a CABAC parsing engine.
The JVT-G050r1 document approach is suboptimal. Unlike the JM software version 6.2 approach, for all cases in which the neighboring macroblock is subpartitioned into 8×8 subpartitions (i.e., P—8×8 or B—8×8 macroblock modes), the JVT-G050r1 document does not consider reference index or motion vector information from the neighboring sub-macroblock (i.e., whether it uses pixel predictions from reference picture list 0 and/or reference picture list 1) when determining the context to be used for CABAC coding of current reference indices and/or motion vectors. Excluding the prediction information from subpartitioned neighboring macroblocks is good in that the implementation problem of the JM software method is solved. However, the exclusion introduces a new suboptimality not present in the JM software version 6.2 in that no consideration is given to whether the neighboring sub-macroblock is using a list 0 or a list 1 motion-vector/reference-index when the current motion-vector/reference-index is coded.
A result is that even though additional contextual information is easily (i.e., without excessive complexity) available when neighboring 8×8 sub-partitions are not predicted using direct-mode or skip, the information is not used. In cases where the additional information could potentially help improve the conditional probability estimates used by the CABAC model for coding the current motion-vector/reference-index, coding efficiency will be decreased. In a preferred approach, motion-vector and reference indices of neighboring 8×8 sub-partitions that are neither skipped nor inferred through direct-mode prediction may be used to select the contexts used for coding the current motion-vectors and/or reference indices.